

var CHART_SOURCES = [
"YAHOO_REUTERS",
"STOCK_REUTERS"
];

var CHART_SOURCES_URL = [
"http://yahoo.reuters.com/stocks/ChartResize.aspx",
"http://stocks.us.reuters.com/"
];

var CHART_FUNCTION =[
getYahooReutersChartUrl,
getStockReutersChartUrl
];

var ZOOM_HEADER = [
[[1,"day","Today"],
[3,"day","3d"],
[1,"week","1w"],
[2,"week","2w"],
[1,"month","1m"],
[2,"month","2m"],
[6,"month","6m"],
[1,"year","1y"],
[2,"year","2y"]],

[[1,"day","Today"],
[5,"day","5d"],
[10,"day","10d"],
[1,"month","1m"],
[6,"month","6m"],
[1,"year","1y"],
[3,"year","3y"]]
];



function setChartZoomHeader(_moduleId,_tableId,_headerConf,_currentDuration, _currentUnit)
{
	
	var table = _gel(_tableId+'_zoom');
	var contentChart = "";
	var zoom_cell;
	//var today_cell;
	
	zoom_cell = table.rows[0].cells[0];
	//today_cell= table.rows[0].cells[1];;
	
	
	contentChart += '<b>Zoom:</b> ';
	
	for(var i=0;i<_headerConf.length;i++)
	{
		if(_currentDuration== _headerConf[i][0] && _currentUnit== _headerConf[i][1])
			contentChart += _headerConf[i][2]+' ';
		else
			contentChart += '<a href ="#" onClick="updateChartPreferences'+_moduleId+'('+_headerConf[i][0]+',\''+_headerConf[i][1]+'\')">'+_headerConf[i][2]+'</a> ';
	}
	
			

	zoom_cell.innerHTML = contentChart;
	//today_cell.innerHTML = '<font size=2><b>Today:</b> '+getDateAsString(new Date())+'</font>';
	
}



function getYahooReutersChartUrl(_conf, _quoteSymbol)
{
		
	return _conf.chartURL+'?symbol='+_quoteSymbol+'&frequency=1day&duration='+_conf.chart_timeDuration+_conf.chart_timeUnit+'&width=250';
}

function getStockReutersChartUrl(_conf, _quoteSymbol, _quoteStockExchange)
{
	var chartURL = _conf.chartURL+"buffer/chartAdvancedBuffer.asp?cht=/reuters/us/research/advanced.cht";
	
	var timeFrame = _conf.chart_timeDuration;
	if(_conf.chart_timeUnit == 'day')
	{
		timeFrame *= 1;
	}
	else if(_conf.chart_timeUnit == 'week')
	{
		timeFrame *= 7;
	}
	else if(_conf.chart_timeUnit == 'month')
	{
		timeFrame *= 30;
	}
	else if(_conf.chart_timeUnit == 'year')
	{
		timeFrame *= 365;
	}
	
	var symbol = getStockExchangeAbbreviation(_quoteStockExchange)+';'+_quoteSymbol.substring(0,4);
	
	var aux = chartURL+'&symbol='+symbol+'&timeFrame='+timeFrame+'&width=260&height=210';
	
	return aux;
}


